package com.qut.atcoder.service.impl;

import com.qut.atcoder.mappers.UserMapper;
import com.qut.atcoder.pojo.User;
import com.qut.atcoder.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired(required = false)
    private UserMapper userMapper;

    @Override
    public int register(User user) {
        user.setIs_exist(1);
        return userMapper.insertUser(user);
    }

    @Override
    public int deleteUser(User user) {
        user.setIs_exist(0);
        int ret = userMapper.updateUserById(user);
        if (ret == 1)
            return 0;
        return 1;
    }
}
